public class Solution149 {
    public int maxPoints(int[][] points) {
        int n=points.length;
        int max=1;
        for (int i=0;i<n;i++){
            for (int j=i+1;j<n;j++){
                int rec=0;
                for (int k=0;k<n;k++){
                    int ikx=points[k][0]-points[i][0];
                    int iky=points[k][1]-points[i][1];
                    int jkx=points[k][0]-points[j][0];
                    int jky=points[k][1]-points[j][1];
                    if (ikx*jky==iky*jkx){
                        rec++;
                    }
                }
                max=Math.max(max,rec);
            }
        }
        return max;
    }

    public static void main(String[] args) {
        System.out.println(new Solution149().maxPoints(new int[][]{{1,1},{3,2},{5,3},{4,1},{2,3},{1,4}}));
    }
}
